package defpackage; import android.app.Activity; import android.app.Dialog; import android.content.Context; import android.content.SharedPreferences; import android.text.TextUtils; import cn.wps.moffice.OfficeApp; import cn.wps.moffice.define.VersionManager; import cn.wps.moffice.main.cloud.roaming.cloudop.CloudDriverTipsInfo; import cn.wps.moffice.main.common.ServerParamsUtil; import cn.wps.moffice_eng.R; import com.iflytek.cloud.SpeechEvent; import com.iflytek.cloud.SpeechUtility; import defpackage.cqb; import java.util.HashMap; import java.util.Iterator; import org.json.JSONException; import org.json.JSONObject; /* renamed from: flf reason: default package */ public class flf { private static final String TAG = flf.class.getSimpleName(); private static boolean fUF = true; private static boolean bj(String str, String str2) { if (TextUtils.isEmpty(str) || TextUtils.isEmpty(str2)) { return true; } long currentTimeMillis = System.currentTimeMillis(); return currentTimeMillis <= ln(str) * 1000 || currentTimeMillis >= ln(str2) * 1000; } public static boolean byC() { return VersionManager.aYQ(); } public static void byD() { JSONObject jSONObject; if (VersionManager.aYQ()) { String str = null; try { str = lwd.f("https://vipapi.wps.cn/android/driver/config", new HashMap()); } catch (Exception e) { e.getMessage(); } if (str != null) { try { JSONObject jSONObject2 = new JSONObject(str); if ("ok".equals(jSONObject2.optString(SpeechUtility.TAG_RESOURCE_RESULT)) && (jSONObject = jSONObject2.getJSONObject(SpeechEvent.KEY_EVENT_RECORD_DATA)) != null) { CloudDriverTipsInfo fromJsonObject = CloudDriverTipsInfo.fromJsonObject(jSONObject.getJSONArray("tips")); jaa.bH(OfficeApp.arx(), "CLOUDDRIVER_TIPS").edit().putString("CLOUDDRIVER_TIPS_DRIVER_INFO", fromJsonObject == null ? "" : fromJsonObject.toJsonObjectString()).commit(); } } catch (JSONException e2) { e2.getMessage(); } } } } public static void byE() { String str; JSONObject jSONObject; String str2; String str3; if (VersionManager.aYQ()) { try { str = lwd.f("https://vipapi.wps.cn/android/driver/config", new HashMap()); } catch (Exception e) { e.getMessage(); str = null; } if (str != null) { try { JSONObject jSONObject2 = new JSONObject(str); if ("ok".equals(jSONObject2.optString(SpeechUtility.TAG_RESOURCE_RESULT)) && (jSONObject = jSONObject2.getJSONObject(SpeechEvent.KEY_EVENT_RECORD_DATA)) != null) { String byH = byH(); boolean byJ = byJ(); if (byJ) { str2 = "privilege_tips"; str3 = byI(); } else { str2 = "list_tips"; str3 = byH; } CloudDriverTipsInfo fromJsonObject = CloudDriverTipsInfo.fromJsonObject(jSONObject.getJSONArray(str2)); String str4 = (fromJsonObject == null || bj(fromJsonObject.start_time, fromJsonObject.end_time)) ? null : fromJsonObject.title; boolean byF = (str4 == null || str4.equals(str3)) ? byF() : true; SharedPreferences bH = jaa.bH(OfficeApp.arx(), "CLOUDDRIVER_TIPS"); if (byJ) { bH.edit().putString("CLOUDDRIVER_LIST_RIGHT_TIPS_DRIVER_INFO", fromJsonObject == null ? "" : fromJsonObject.toJsonObjectString()).commit(); } else { bH.edit().putString("CLOUDDRIVER_LIST_TIPS_DRIVER_INFO", fromJsonObject == null ? "" : fromJsonObject.toJsonObjectString()).commit(); } bH.edit().putBoolean("CLOUDDRIVER_LIST_TIPS_DRIVER_RED_DOT", byF).commit(); } } catch (JSONException e2) { e2.getMessage(); } } } } public static boolean byF() { boolean z; ServerParamsUtil.Params tG = ServerParamsUtil.tG("op_wpscloud"); if (tG == null || tG.result != 0 || !"on".equals(tG.status)) { z = false; } else { if (tG.extras != null) { Iterator<ServerParamsUtil.Extras> it = tG.extras.iterator(); while (true) { if (!it.hasNext()) { break; } ServerParamsUtil.Extras next = it.next(); if ("cloud_drive_list_red_dot".equals(next.key)) { z = "on".equals(next.value); break; } } } z = false; } if (!z) { return false; } return jaa.bH(OfficeApp.arx(), "CLOUDDRIVER_TIPS").getBoolean("CLOUDDRIVER_LIST_TIPS_DRIVER_RED_DOT", false); } public static String byG() { boolean z; ServerParamsUtil.Params tG = ServerParamsUtil.tG("op_wpscloud"); if (tG == null || tG.result != 0 || !"on".equals(tG.status)) { z = false; } else { if (tG.extras != null) { Iterator<ServerParamsUtil.Extras> it = tG.extras.iterator(); while (true) { if (!it.hasNext()) { break; } ServerParamsUtil.Extras next = it.next(); if ("cloud_driver_tips".equals(next.key)) { z = "on".equals(next.value); break; } } } z = false; } if (!z) { return null; } CloudDriverTipsInfo parseCloudDriverTipsInfo = CloudDriverTipsInfo.parseCloudDriverTipsInfo(jaa.bH(OfficeApp.arx(), "CLOUDDRIVER_TIPS").getString("CLOUDDRIVER_TIPS_DRIVER_INFO", "")); if (parseCloudDriverTipsInfo == null || bj(parseCloudDriverTipsInfo.start_time, parseCloudDriverTipsInfo.end_time)) { return null; } return parseCloudDriverTipsInfo.title; } public static String byH() { boolean z; ServerParamsUtil.Params tG = ServerParamsUtil.tG("op_wpscloud"); if (tG == null || tG.result != 0 || !"on".equals(tG.status)) { z = false; } else { if (tG.extras != null) { Iterator<ServerParamsUtil.Extras> it = tG.extras.iterator(); while (true) { if (!it.hasNext()) { break; } ServerParamsUtil.Extras next = it.next(); if ("cloud_drive_list_tips".equals(next.key)) { z = "on".equals(next.value); break; } } } z = false; } if (!z) { return null; } CloudDriverTipsInfo parseCloudDriverTipsInfo = CloudDriverTipsInfo.parseCloudDriverTipsInfo(jaa.bH(OfficeApp.arx(), "CLOUDDRIVER_TIPS").getString("CLOUDDRIVER_LIST_TIPS_DRIVER_INFO", "")); if (parseCloudDriverTipsInfo == null || bj(parseCloudDriverTipsInfo.start_time, parseCloudDriverTipsInfo.end_time)) { return null; } return parseCloudDriverTipsInfo.title; } public static String byI() { CloudDriverTipsInfo parseCloudDriverTipsInfo; if (byJ() && (parseCloudDriverTipsInfo = CloudDriverTipsInfo.parseCloudDriverTipsInfo(jaa.bH(OfficeApp.arx(), "CLOUDDRIVER_TIPS").getString("CLOUDDRIVER_LIST_RIGHT_TIPS_DRIVER_INFO", ""))) != null && !bj(parseCloudDriverTipsInfo.start_time, parseCloudDriverTipsInfo.end_time)) { return parseCloudDriverTipsInfo.title; } return null; } public static boolean byJ() { ServerParamsUtil.Params tG = ServerParamsUtil.tG("op_wpscloud"); if (tG == null || tG.result != 0 || !"on".equals(tG.status)) { return false; } if (tG.extras == null) { return false; } for (ServerParamsUtil.Extras extras : tG.extras) { if ("cloud_drive_list_right_tips".equals(extras.key)) { return "on".equals(extras.value); } } return false; } public static boolean cD(Context context) { boolean z; if (!ebo.arU() && VersionManager.aYQ()) { ServerParamsUtil.Params tG = ServerParamsUtil.tG("op_wpscloud"); if (tG == null || tG.result != 0 || !"on".equals(tG.status)) { z = false; } else { if (tG.extras != null) { Iterator<ServerParamsUtil.Extras> it = tG.extras.iterator(); while (true) { if (!it.hasNext()) { break; } ServerParamsUtil.Extras next = it.next(); if ("cloud_drive_home_login_guide".equals(next.key)) { z = "on".equals(next.value); break; } } } z = false; } if (z) { if (!fUF) { return false; } if (!cqb.a.cow.cot) { return false; } String string = jaa.bH(OfficeApp.arx(), "CLOUDDRIVER_TIPS").getString("CLOUDDRIVER_LOGIN_GUIDE_VERSION_NAME", ""); String string2 = context.getString(R.string.app_version_name); if (lwv.isEmpty(string2)) { return false; } if (string2.equalsIgnoreCase(string)) { return false; } if (!got.dK(context)) { return false; } Dialog topDialog = czq.getTopDialog(); return topDialog == null || !topDialog.isShowing(); } } return false; } public static void cE(Context context) { SharedPreferences bH = jaa.bH(OfficeApp.arx(), "CLOUDDRIVER_TIPS"); String string = context.getString(R.string.app_version_name); if (string == null) { string = ""; } bH.edit().putString("CLOUDDRIVER_LOGIN_GUIDE_VERSION_NAME", string).commit(); Activity activity = (Activity) context; if (!ebo.arU() && !gbr.bLG().bLz()) { gbr.bLG().i(activity, null); } } public static void kP(boolean z) { jaa.bH(OfficeApp.arx(), "CLOUDDRIVER_TIPS").edit().putBoolean("CLOUDDRIVER_LIST_TIPS_DRIVER_RED_DOT", false).commit(); } public static void kQ(boolean z) { fUF = z; } private static long ln(String str) { try { return Long.parseLong(str); } catch (Exception e) { return 0; } } }